<template>
  <view class="home">首页</view>
  <uni-card title="基础卡片" extra="额外信息">
    <text>这是一个基础卡片示例，此示例展示了一个标题加标题额外信息的标准卡片。</text>
  </uni-card>
  <view>num:{{ countStore.num }}</view>
  <button @tap="addCount" size="mini" plain type="primary">加num</button>
  <button @tap="countStore.resetNum()" size="mini" plain type="warn">归零</button>
  <view>
    {{ data }}
  </view>
  <button @click="testHttp" size="mini" plain type="primary">测试请求</button>
</template>

<script setup lang="ts">
interface banner {
  hrefUrl: string
  id: string
  imgUrl: string
  type: string
}
import { ref } from 'vue'
import { useCountStore } from '@/store'
import { get } from '@/utils/http'
const countStore = useCountStore()
let data = ref<banner[]>([])
const addCount = () => {
  countStore.setNumber(countStore.num + 10)
}
const testHttp = async () => {
  const res = await get<banner[]>('/home/banner')
  data.value = res.result
  console.log(res)
}
</script>
<style></style>
